package com.vf.admin.platform.entity;


import com.vf.admin.common.db.annotation.Column;
import com.vf.admin.common.db.annotation.NoColumn;
import com.vf.admin.common.db.annotation.Table;
import com.vf.admin.utils.Base64Image.GenerateImage;

import java.util.ArrayList;
import java.util.List;

@Table(name = "app_image")
public class AppImage {
    private static final long serialVersionUID = 1L;
    @Column(length=10,name="id",index=true)
    private Integer id;
    private String name;
    private String avatar;
    private String banner;
    private String infoImg;

    @NoColumn
    private List<String> bannerlist;
    @NoColumn
    private List<String> infoImglist;

    public List<String> getBannerlist() {
        bannerlist=new ArrayList<>();

        if(banner!=null&&banner!=""){
           String str[]=banner.split(",");
           for (String ba:str){
               String imageStr =  GenerateImage.imgBase64(ba);
               bannerlist.add("data:image/jpeg;base64,"+imageStr);
           }
        }
        return bannerlist;
    }



    public List<String> getInfoImglist() {
        infoImglist=new ArrayList<>();
        if(infoImg!=null&&infoImg!=""){
            String str[]=infoImg.split(",");
            for (String ba:str){
                String imageStr =  GenerateImage.imgBase64(ba);
                infoImglist.add("data:image/jpeg;base64,"+imageStr);
            }
        }
        return infoImglist;
    }



    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getBanner() {
        return banner;
    }

    public void setBanner(String banner) {
        this.banner = banner;
    }

    public String getInfoImg() {
        return infoImg;
    }

    public void setInfoImg(String infoImg) {
        this.infoImg = infoImg;
    }
}
